﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true" CodeFile="UserUpdate.aspx.cs" Inherits="UserManage_UserUpdate" Title="更新用户信息" %>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<script language="javascript" type="text/javascript">       
        function SearchCountry(ObjID)
        {
            var oid = ObjID.substring(0,ObjID.lastIndexOf('_') + 1);
            var objSearch = document.getElementById(ObjID);
            var obj1 = document.getElementById(oid + "ddlSClient"); 
            var obj = document.getElementById(oid + "ddlSClientSearch");
            
            for(var i = obj1.length-1;i > -1;i--)
            {
	            obj1.remove(i);
            }

            for(var i=0;i < obj.length;i++)
            { 
	            if(obj[i].text.toUpperCase().indexOf(objSearch.value.toUpperCase()) > -1){	            
		            obj1.add(new Option(obj[i].text,obj[i].value));	
	            }
            }            
        }    
        
        function BConfim()
        {
        var a = document.getElementsByTagName("input");
        var isSel = 0;
        for(var i=0;i<a.length;i++)
        {
            if(a[i].type == "radio")
            {
                if(a[i].checked == true)
                {
                    isSel += 1;
                }
            }
        }
        if(isSel == 0)
        {
            alert("请选择一条记录!");
            return false;
            
        }
        else
        {
           return true;
        }
      
    }    
    </script>

    <div id="myDiv" runat="server" class="divBgCover">
    </div>
    <div id="divError" runat="server" class="blue divActiveWindow">
       <%-- <div class="title">
            <asp:Label ID="lblTitle" runat="server" Text="请选择用户所属公司"></asp:Label></div>--%>
        <table width="100%" align="center">
            <tr>
                <td>
                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <div class="title">
                                <asp:Label ID="Label2" runat="server" Text="请选择客户公司"></asp:Label></div>
                            <table class="add_table" cellspacing="1" cellpadding="3">
                                <tr>
                                    <td align="right">
                                        <asp:DropDownList ID="ddlColumnName" runat="server">
                                            <asp:ListItem Text="客户代码" Value="Code"></asp:ListItem>
                                            <asp:ListItem Text="公司中文名" Value="CNName"></asp:ListItem>
                                            <asp:ListItem Text="公司英文名" Value="ENGName"></asp:ListItem>
                                            <asp:ListItem Text="公司台头" Value="Title"></asp:ListItem>
                                            <asp:ListItem Text="公司业务员" Value="LocalBP"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                                    </td>
                                    <td align="right">
                                        <asp:Label ID="lblModel" runat="server" Text="客户类型："></asp:Label>
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlType" runat="server">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4" align="center">
                                        <asp:Button ID="btnSearch" runat="server" CssClass="btn" Text="搜索" OnClick="btnSearch_Click" />
                                    </td>
                                </tr>
                            </table>
                            <div id="divEntrust" runat="server">
                                <div class="list_title">
                                    <div class="autoleft">
                                        <asp:Label ID="lblSelectOut" runat="server" Text="检索出"></asp:Label><asp:Label ID="lblTotal"
                                            runat="server"></asp:Label>
                                        <asp:Label ID="lblSelectOut2" runat="server" Text="个客户"></asp:Label></div>
                                    <div class="autoright">
                                        <asp:Label ID="lblPerPage" runat="server" Text="每页显示："></asp:Label>
                                        <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">
                                            <asp:ListItem Selected="True" Text="10" Value="10"></asp:ListItem>
                                            <asp:ListItem Text="15" Value="15"></asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <asp:GridView ID="gvClientList" runat="server" AllowPaging="True" PageSize="10" AutoGenerateColumns="false"
                                    Width="100%" AllowSorting="true" PagerSettings-Mode="NumericFirstLast" OnPageIndexChanging="gvClientList_PageIndexChanging"
                                    OnSorting="gvClientList_Sorting">
                                    <PagerTemplate>
                                        <table style="width: 100%">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblPerPage" runat="server" Text="页次"></asp:Label>:&nbsp;<asp:Label
                                                        ID="Label1" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1      %>'></asp:Label>/<asp:Label
                                                            ID="Label2" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label><asp:Label
                                                                ID="lblPage" runat="server" Text="页"></asp:Label>&nbsp;
                                                    <asp:Label ID="lblTotalPages" runat="server" Text="总计"></asp:Label>:&nbsp;<asp:Label
                                                        ID="Label3" runat="server" Text="<%# ((System.Data.DataView)gvClientList.DataSource).Count %>"></asp:Label>
                                                </td>
                                                <td align="right">
                                                    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="First"
                                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" Text="首页"></asp:LinkButton>
                                                    <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="Prev" CommandName="Page"
                                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" Text="前页"></asp:LinkButton>
                                                    <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="Next"
                                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>"
                                                        Text="后页"></asp:LinkButton>
                                                    <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument="Last" CommandName="Page"
                                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>"
                                                        Text="尾页"></asp:LinkButton>&nbsp;
                                                    <asp:Label ID="lblTurnOn" runat="server" Text="转第"></asp:Label><asp:TextBox ID="txtPages"
                                                        runat="server" Width="35px"></asp:TextBox>
                                                    <asp:Label ID="lblPages2" runat="server" Text="页"></asp:Label>
                                                    <asp:LinkButton ID="lbtnGo" runat="server" Text="提交" OnClick="lbtnGo_Click"></asp:LinkButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </PagerTemplate>
                                    <Columns>
                                        <asp:TemplateField HeaderText="选择">
                                            <ItemTemplate>
                                                <input type="radio" name="chkSelected" value="<%# DataBinder.Eval(Container.DataItem,"PKID")%>" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="客户代码" SortExpression="Code">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCodes" runat="server" Text='<%# Eval("Code")%>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="公司简称(中文)" SortExpression="CNName">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCNName" runat="server" Text='<%# Eval("CNName")%>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="公司简称(英文)" SortExpression="ENGName">
                                            <ItemTemplate>
                                                <asp:Label ID="lblENGName" runat="server" Text='<%# Eval("ENGName")%>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <RowStyle HorizontalAlign="Center" />
                                </asp:GridView>
                            </div>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
              
                <td align="center">
                    <asp:Button ID="btnSub" runat="server" Text="提交" CssClass="btn" OnClick="btnSub_Click" />&nbsp;&nbsp;<asp:Button
                        ID="btnClose" CssClass="btn" runat="server" Text="返回" OnClick="btnClose_Click" />
                    <asp:HiddenField ID="hidAdminID" runat="server" />
                </td>
            </tr>
            <tr>
            <td align="center"><asp:Label ID="lblError" runat="server" Visible="false" Text="请选择一个客户!" ForeColor="Red"></asp:Label></td>
            </tr>
        </table>
    </div>

    <div class="title">
        &nbsp;<asp:Label ID="lblPageType" runat="server" Text="更新用户信息"></asp:Label></div>
    <table class="add_table" cellspacing="1" cellpadding="3" align="center">
        <tr>
            <td align="right">
               <asp:Label ID="lblLoginID" runat="server" Text="登录名："></asp:Label>
            </td>
            <td>
                <asp:Label  ID="txtLoginID" runat="server" Width="172px" ></asp:Label>               
            </td>
        </tr>         
        
        <tr>
            <td align="right">
               <asp:Label ID="lblRoleCode" runat="server" Text=" 用户名称："></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtUserName" runat="server" Width="172px" ></asp:TextBox>
              
            </td>
        </tr>   
        <tr>
            <td align="right">
               <asp:Label ID="lblEmail" runat="server" Text=" E-mail："></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtEmail" runat="server" Width="172px" ></asp:TextBox>
              
            </td>
        </tr>  
          <tr>
            <td align="right">
                <asp:Label ID="Label1" runat="server" Text="所属公司："></asp:Label>
            </td>
            <td>
            <asp:HiddenField ID="hidClientID" runat="server" />
                <asp:TextBox ID="txtClientName" runat="server" Enabled="false"></asp:TextBox>
                <asp:LinkButton ID="lbtnClientSel" runat="server" Text="选择..." OnClick="lbtnClientSel_Click"></asp:LinkButton>
            </td>
        </tr>     
        
        <tr>
            <td align="right">
                <asp:Label ID="lblUserRole" runat="server" Text="用户所属角色："></asp:Label>
            </td>
            <td>
              <asp:CheckBoxList ID="chkRolesList" runat="server" RepeatColumns="5" RepeatDirection="Horizontal"
                        ValidationGroup="user" RepeatLayout="Table">
                    </asp:CheckBoxList>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:Label ID="lblUserStatus" runat="server" Text="状态："></asp:Label>
            </td>
            <td>
                 <asp:RadioButton ID="radYes" runat="server" Checked="true" Text="有效" GroupName="Activity" /><asp:RadioButton
                        ID="radNo" runat="server" Text="失效" GroupName="Activity" />
            </td>
        </tr>
    </table>
    <table class="add_table" cellspacing="1" cellpadding="3">
        <tr>
            <td align="center">
                <asp:Button ID="btnSave" runat="server" Text="更新" OnClick="btnSave_Click" CssClass="btn"  />
               &nbsp; <asp:Button ID="btnReset" runat="server" Text="返回" CssClass="btn" OnClick="btnReset_Click" />

            </td>
        </tr>
    </table>      
</asp:Content>

